//
//  SuperLabel.swift
//  主题切换
//
//  Created by 王帅强 on 2019/1/14.
//  Copyright © 2019 王帅强. All rights reserved.
//

import UIKit

class SuperLabel: UILabel, ThemeManagerProtocol {

    override init(frame: CGRect) {
        super.init(frame: frame)
        text = "这是一个label"
        registNotification()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    func registNotification() {
        NotificationCenter.default.addObserver(self, selector: #selector(handelNotification(notification:)), name: ThemeNotifacationName, object: nil)
    }

    @objc func handelNotification(notification: NSNotification) {
        guard let theme = notification.object as? ThemeProtocol else {
            return
        }
        themeTextColor(theme: theme)
    }

    func themeTextColor(theme:ThemeProtocol) {
        
    }

    deinit {
        NotificationCenter.default.removeObserver(self)
    }

   

}
